﻿using EasyClassWEBAPI.EntityClass;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace EasyClassWEBAPI.Models
{
    public class EasyClassContext:DbContext
    {
        /// <summary>
        /// 自动生成数据库
        /// </summary>
        /// <param name="options"></param>
        public EasyClassContext(DbContextOptions<EasyClassContext> options) : base(options)
        {
            this.Database.EnsureCreated(); 
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }
        public DbSet<User> Users { get; set; }
        public DbSet<Post> Posts { get; set; }
        public DbSet<Comment> Comments { get; set; }
        public DbSet<StudyGroup> StudyGroups { get; set; }
        public DbSet<StudyResource> StudyResources { get; set; }

    }
}
